/**
 * Requirement entity. Getters & setters.
 */
package com.xoomworks.rsfr.model;

import java.io.Serializable;
import java.util.Date;

/**
 * The persistent class for the requirements database table.
 * @author andrea.ghisa
 *
 */
public class Requirement extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    private Date createdOn;

    private String description;

    private String location;

    private Date modifiedOn;

    private String otherRequirements;

    private String requiredResourceCompetencies;

    private String requiredResourceTitle;

    private Date requirementEndDate;

    private Date requirementStartDate;

    private String requirementTitle;

    // uni-directional many-to-one association to User
    private User createdBy;

    // bi-directional many-to-one association to User
    private User modifiedBy;

    // uni-directional many-to-one association to Company
    private Company company;

    /**
     *Constructor with no fields.
     */
    public Requirement() {
    }

    /**
     * Constructor with specified parameters.
     * @param createdOn Date Represents the data when the request was created.
     * @param description String Represents the description of the requirement.
     * @param requirementTitle String Represents the title of the requirement.
     * @param createdBy User Represents the  user who created the requirement.
     * @param company Company Represents the company where user who made the request belongs.
     */
    public Requirement(final Date createdOn, final String description,
            final String requirementTitle, final User createdBy, final Company company) {
        super();
        this.createdOn = createdOn;
        this.description = description;
        this.requirementTitle = requirementTitle;
        this.createdBy = createdBy;
        this.company = company;
    }

    /**
     * Constructor with specified parameters.
     * @param description String Represents the description of the requirement.
     * @param location Sting Represents the location
     * @param otherRequirements  String Represents the other requirements which company needs.
     * @param requiredResourceCompetencies String Represents the competencies  which resource must have.
     * @param requiredResourceTitle String Represents  the title  which resource must have.
     * @param requirementEndDate Date Represents the date which request ends.
     * @param requirementStartDate Date Represents the date which request starts.
     * @param requirementTitle String Represents the title  which resource must have.
     * @param company Company Represents the company who needs a resource.
     */
    public Requirement(final String description, final String location,
            final String otherRequirements, final String requiredResourceCompetencies,
            final String requiredResourceTitle, final Date requirementEndDate,
            final Date requirementStartDate, final String requirementTitle, final Company company) {
        super();
        this.description = description;
        this.location = location;
        this.otherRequirements = otherRequirements;
        this.requiredResourceCompetencies = requiredResourceCompetencies;
        this.requiredResourceTitle = requiredResourceTitle;
        this.requirementEndDate = requirementEndDate;
        this.requirementStartDate = requirementStartDate;
        this.requirementTitle = requirementTitle;
        this.company = company;
    }

    /**
     * Gets the date when requirement was created.
     * @return createdOn Date Represents the date when requirement was created.
     */
    public Date getCreatedOn() {
        return this.createdOn;
    }

    /**
     * Sets the date when requirement was created.
     * @param createdOn Date Which is used to set createdOn.
     */
    public void setCreatedOn(final Date createdOn) {
        this.createdOn = createdOn;
    }

    /**
     * Gets the description of the requirement.
     * @return description String Represents the description of the requirement.
     */
    public String getDescription() {
        return this.description;
    }

    /**
     * Sets the description of the requirement.
     * @param description String Which is used to set the description.
     */
    public void setDescription(final String description) {
        this.description = description;
    }

    /**
     * Gets the location of the requirements.
     * @return location String Represents the location of the requirements.
     */
    public String getLocation() {
        return this.location;
    }

    /**
     * Sets the location of the requirements.
     * @param location String which is used to set the location.
     */
    public void setLocation(final String location) {
        this.location = location;
    }

    /**
     * Gets the date when the requirement was modified.
     * @return modificatedOn Data Represents the date when the requirement was modified.
     */
    public Date getModifiedOn() {
        return this.modifiedOn;
    }

    /**
     * Sets  the date when the requirement was modified.
     * @param modifiedOn Date Which is used to set the modifiedOn.
     */
    public void setModifiedOn(final Date modifiedOn) {
        this.modifiedOn = modifiedOn;
    }

    /**
     * Gets the other requirements which company needs.
     * @return othereRequirements String Represents other requirements which company needs.
     */
    public String getOtherRequirements() {
        return this.otherRequirements;
    }

    /**
     * Sets the other requirements which company needs.
     * @param otherRequirements String Which is used to set the otherReuirements.
     */
    public void setOtherRequirements(final String otherRequirements) {
        this.otherRequirements = otherRequirements;
    }

    /**
     * Gets the competencies  which resource must have.
     * @return requiredResourceCompetencies String Represents the competencies  which resource must have.
     */
    public String getRequiredResourceCompetencies() {
        return this.requiredResourceCompetencies;
    }

    /**
     * Sets the competencies  which resource must have.
     * @param requiredResourceCompetencies String which is used to set the RequiredResourceCompetencies.
     */
    public void setRequiredResourceCompetencies(
            final String requiredResourceCompetencies) {
        this.requiredResourceCompetencies = requiredResourceCompetencies;
    }

    /**
     * Gets the source title of the requirement.
     * @return requiredResourceTitle Represents the source title of the requirement.
     */
    public String getRequiredResourceTitle() {
        return this.requiredResourceTitle;
    }

    /**
     * Sets the source title of the requirement.
     * @param requiredResourceTitle String Which is used to set RequiredResourceTitle.
     */
    public void setRequiredResourceTitle(final String requiredResourceTitle) {
        this.requiredResourceTitle = requiredResourceTitle;
    }

    /**
     * Gets the requirement end date.
     * @return requirementEndDate Date Represents the requirement end date.
     */
    public Date getRequirementEndDate() {
        return this.requirementEndDate;
    }

    /**
     * Sets the requirement end date.
     * @param requirementEndDate Date Which is used to set RequirementEndDate.
     */
    public void setRequirementEndDate(final Date requirementEndDate) {
        this.requirementEndDate = requirementEndDate;
    }

    /**
     * Gets the requirement start date.
     * @return requirementStartDate Date Represents the requirement start date.
     */
    public Date getRequirementStartDate() {
        return this.requirementStartDate;
    }

    /**
     * Sets the requirement start date.
     * @param requirementStartDate Date which is used to set the RequirementStartDate.
     */
    public void setRequirementStartDate(final Date requirementStartDate) {
        this.requirementStartDate = requirementStartDate;
    }

    /**
     * Gets the requirement title.
     * @return requirementTitle String Represents the requirement title.
     */
    public String getRequirementTitle() {
        return this.requirementTitle;
    }

    /**
     * Sets the requirement title.
     * @param requirementTitle String Which is used to set RequirementTitle.
     */
    public void setRequirementTitle(final String requirementTitle) {
        this.requirementTitle = requirementTitle;
    }

    /**
     * Gets the user who created the requirement.
     * @return createdBy User Represents the user who created the requirement.
     */
    public User getCreatedBy() {
        return this.createdBy;
    }

    /**
     * Sets the user who created the requirement.
     * @param createdBy User Which is used to set the createdBy.
     */
    public void setCreatedBy(final User createdBy) {
        this.createdBy = createdBy;
    }

    /**
     * Gets the user who modified the requirement.
     * @return modifiedBy User Represents the user who modified the requirement.
     */
    public User getModifiedBy() {
        return this.modifiedBy;
    }

    /**
     * Set the user who modified the requirement.
     * @param modifiedBy User Which is used to set the modifiedBy.
     */
    public void setModifiedBy(final User modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    /**
     * Gets the company who made the request.
     * @return company Company Represents the company who made the request.
     */
    public Company getCompany() {
        return this.company;
    }

    /**
     * Sets the company who made the request.
     * @param company Company Which is used to set the company.;
     */
    public void setCompany(final Company company) {
        this.company = company;
    }

    @Override
    public String toString() {
        return "Requirement [createdOn=" + createdOn + ", description="
                + description + ", location=" + location + ", modifiedOn="
                + modifiedOn + ", otherRequirements=" + otherRequirements
                + ", requiredResourceCompetencies="
                + requiredResourceCompetencies + ", requiredResourceTitle="
                + requiredResourceTitle + ", requirementEndDate="
                + requirementEndDate + ", requirementStartDate="
                + requirementStartDate + ", requirementTitle="
                + requirementTitle + ", createdBy=" + createdBy
                + ", modifiedBy=" + modifiedBy + ", company=" + company + "]";
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = (prime * result)
                + ((description == null) ? 0 : description.hashCode());
        result = (prime * result)
                + ((location == null) ? 0 : location.hashCode());
        result = (prime
                * result)
                + ((otherRequirements == null) ? 0 : otherRequirements
                        .hashCode());
        result = (prime
                * result)
                + ((requiredResourceCompetencies == null) ? 0
                        : requiredResourceCompetencies.hashCode());
        result = (prime
                * result)
                + ((requiredResourceTitle == null) ? 0 : requiredResourceTitle
                        .hashCode());
        result = (prime
                * result)
                + ((requirementEndDate == null) ? 0 : requirementEndDate
                        .hashCode());
        result = (prime
                * result)
                + ((requirementStartDate == null) ? 0 : requirementStartDate
                        .hashCode());
        result = (prime
                * result)
                + ((requirementTitle == null) ? 0 : requirementTitle.hashCode());
        return result;
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Requirement other = (Requirement) obj;
        if (description == null) {
            if (other.description != null) {
                return false;
            }
        } else if (!description.equals(other.description)) {
            return false;
        }
        if (location == null) {
            if (other.location != null) {
                return false;
            }
        } else if (!location.equals(other.location)) {
            return false;
        }
        if (otherRequirements == null) {
            if (other.otherRequirements != null) {
                return false;
            }
        } else if (!otherRequirements.equals(other.otherRequirements)) {
            return false;
        }
        if (requiredResourceCompetencies == null) {
            if (other.requiredResourceCompetencies != null) {
                return false;
            }
        } else if (!requiredResourceCompetencies
                .equals(other.requiredResourceCompetencies)) {
            return false;
        }
        if (requiredResourceTitle == null) {
            if (other.requiredResourceTitle != null) {
                return false;
            }
        } else if (!requiredResourceTitle.equals(other.requiredResourceTitle)) {
            return false;
        }
        if (requirementEndDate == null) {
            if (other.requirementEndDate != null) {
                return false;
            }
        } else if (!requirementEndDate.equals(other.requirementEndDate)) {
            return false;
        }
        if (requirementStartDate == null) {
            if (other.requirementStartDate != null) {
                return false;
            }
        } else if (!requirementStartDate.equals(other.requirementStartDate)) {
            return false;
        }
        if (requirementTitle == null) {
            if (other.requirementTitle != null) {
                return false;
            }
        } else if (!requirementTitle.equals(other.requirementTitle)) {
            return false;
        }
        return true;
    }

}
